<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['系统基础管理','角色管理']" icon="fa fa-list" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>角色管理</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">用户类型</span>
									<select name="" class="top_module_select" [(ngModel)]="userType" (change)='table_search()'>
										<option value="">全部</option>
										<option *ngFor="let item of userTypeList" [value]='item.id'>{{item.text}}</option>
									</select>
								</div>
								<button class="btn btn-primary" (click)="table_search()">查询</button>
								<button  type="button"  class="btn btn-primary" (click)="new_role('new')" *ngIf="roleAdd">添加</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="角色名称...">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>编号</th>
										<th>用户类型</th>
										<th>角色名称</th>
										<th>角色标识</th>
										<th>角色描述</th>
										<th>创建者</th>
										<th>创建时间</th>
										<th>更新时间</th>
										<th *ngIf="roleEdit||roleDeleteBatch">操作</th>
										<th>权限分配</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData" >
										<td>{{row.id}}</td>
										<td>
											{{row.userTypeName}}
											<!-- <span *ngIf="row.userType == 0">其他</span>
											<span *ngIf="row.userType == 1">管理员</span>
											<span *ngIf="row.userType == 2">公司用户</span>
											<span *ngIf="row.userType == 3">项目管理</span>
											<span *ngIf="row.userType == 4">项目实施-内部</span>
											<span *ngIf="row.userType == 5">项目实施-代维</span>
											<span *ngIf="row.userType == 6">项目实施-外包</span>
											<span *ngIf="row.userType == 7">客户</span>
											<span *ngIf="row.userType == 8">测试</span> -->
										</td>
										<td>{{row.name}}</td>
										<td>{{row.key}}</td>
										<td>{{row.description}}</td>
										<td>{{row.creatorName}}</td>
										<td>{{row.createTime}}</td>
										<td>{{row.updateTime}}</td>
										<td *ngIf="roleEdit||roleDeleteBatch">
										 	<button type="button" (click)="updata_role(row)" *ngIf="roleEdit">编辑</button>
											<button type="button" (click)="del_role(row)" *ngIf="roleDeleteBatch">删除</button>
										</td>
										<td>
											<button type="button" (click)="home_access(row)" *ngIf="roleHomepermission">首页</button>
											<button type="button" (click)="menu_access(row)" *ngIf="roleMenupermission">菜单</button>
											<button type="button" (click)="car_access(row)" *ngIf="roleDatapermission">车辆</button>
											<button type="button" (click)="rail_access(row)">围栏</button>
											<button type="button" (click)='binding(row)'>绑定<i class="fa fa-question-circle" title="绑定勾选的公司后，新增的车辆，自动关联到该角色" style="vertical-align: top;color: #ccc;margin-left: 1px;margin-top: -2px;"></i></button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
</div>